﻿'Norman Johnson

Imports DBUtilitiesLibrary
Imports DARSClassLibrary

Public Class StudentDeleteAppointments
    Inherits System.Web.UI.Page
    Dim ws As DO_NOT_MOVE_ME_FROM_THIS_PROJECT.DARSWebservice

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'Check if user is logged in
        If Session("CurrentUser") Is Nothing Then
            Response.Redirect("NotLoggedIn.aspx")
            Exit Sub
        End If
        If Not IsPostBack Then
            View()
        End If

        btnDelete.Visible = False

    End Sub

    Protected Sub btnDelete_Click(sender As Object, e As EventArgs) Handles btnDelete.Click
        'Dim count As New Integer
        'Dim cbox As CheckBox
        'Dim ddList As DropDownList
        'Dim I As Integer


        'Dim Advisor As Integer = CInt(ddlAdvisors.SelectedValue)
        'Dim objStudent As Student
        'objStudent = CType(Session("CurrentUser"), Student)

        'Dim Student As Integer = CInt(objStudent.studentID)
        'Dim Reason As String
        'Dim Dates As DateTime

        'For I = 0 To (gvAppointments.Rows.Count - 1)
        '    ws = CType(Session("Pxy"), DO_NOT_MOVE_ME_FROM_THIS_PROJECT.DARSWebservice)
        '    cbox = CType(gvAppointments.Rows(I).FindControl("cboxSelect"), CheckBox)

        '    If cbox.Checked Then


        '        ddList = CType(gvAppointments.Rows(I).FindControl("ddlReason"), DropDownList)
        '        Reason = ddList.SelectedValue
        '        Dates = CType(gvAppointments.Rows(I).Cells(1).Text, DateTime)

        '        ws.updateStudentAppointment(Advisor, Dates, Reason, Student)

        '    End If
        'Next
        'populateGridview()
    End Sub

    Public Sub view()
        ws = New DO_NOT_MOVE_ME_FROM_THIS_PROJECT.DARSWebservice
        Session("Pxy") = ws
        Dim objStudent As Student = CType(Session("CurrentUser"), Student)
        Dim ds As DataSet = ws.getStudentAppointments(objStudent.studentID)
        Dim objdv As New DataView(ds.Tables(0))
        gvDeleteAppointments.DataSource = objdv
        gvDeleteAppointments.DataBind()
    End Sub


    Protected Sub logout(ByVal sender As Object, ByVal e As EventArgs) Handles btnLogout.ServerClick
        Session.Abandon()
        Response.Redirect("NotLoggedIn.aspx")
    End Sub

    Protected Sub home(ByVal sender As Object, ByVal e As EventArgs) Handles btnhome.ServerClick
        Response.Redirect("LandingPage.aspx")
    End Sub

End Class